version-lp-rs
A rust library for dealing with versions designed to be used with lovepack tools.
Overview
Contains a custom version Struct that is based on the Semantic Versioning System. Only supports the a.b.c
format, but with any number of points, i.e. a.b
, a.b.c.d
are also valid versions. Also has support for wildcards when compairing Versions
.
let wild_version = from_str;
from_string.unwrap.is_compatible_with // will return true
And standard comparions can be used.
let ver_a = from_str;
let ver_b = from_str;
let ver_c = from_str;
ver_a < ver_b // true
ver_a == ver_c // true
You can also get the latest available version from a list.
let versions : = vec!;
let requirement = from_str.unwrap;
let version = requirement.latest_compatible_version; // would be Version (1.1.0)
Notes for Success
- You cannot compare against patterns, patterns can only be checked using the
is_compatible_with
function. - Wildcards will be assumed when compairing different length version numbers.
1.2
will be compatible with1.2.3
Pattern Matching
Currently the only wildcard supported is *
. But ^
can be achieved by using short versions: 1.2
would match with 1.2.1
to 1.2.100
and would return the latest version in a list using ::latest_compatible_version
.